package com.ronx.scs.configuration;


import org.springframework.context.annotation.Bean;
import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer;
import org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver;

//@Configuration
//@PropertiesValueSource(locations = {"application.properties"})
public class FreemarkerConfiguration {

    @Bean
    FreeMarkerConfigurer freeMarkerConfigurer() {
        FreeMarkerConfigurer freeMarkerConfigurer = new FreeMarkerConfigurer();
        freeMarkerConfigurer.setTemplateLoaderPath("WEB-INF/");
        freeMarkerConfigurer.setDefaultEncoding("UTF-8");
        return freeMarkerConfigurer;
    }

    @Bean
    FreeMarkerViewResolver freeMarkerViewResolver() {
        FreeMarkerViewResolver freeMarkerViewResolver = new FreeMarkerViewResolver();
        {
            freeMarkerViewResolver.setCache(true);
            freeMarkerViewResolver.setPrefix("ftl");
            freeMarkerViewResolver.setSuffix(".ftl");
            freeMarkerViewResolver.setContentType("UTF-8");
            freeMarkerViewResolver.setExposeSpringMacroHelpers(true);
        }
        return freeMarkerViewResolver;
    }
}
